package com.ms.framework.util;

/**
 * @see
 * @author jingyul
 * @version 1.0
 * @preserve protected
 */
public class Page {
	private long curPage = 1;
	private long totalPage;
	private long totalRows;
	private long pageSize = 5;

	public Page() {

	}

	public Page(long curPage) {
		this.curPage = curPage;
	}

	public Page(long curPage, long pageSize) {
		if(curPage>1){this.curPage = curPage;}
		if(pageSize>0){this.pageSize = pageSize;}
	}

	public long getCurPage() {
		return curPage;
	}

	public void setCurPage(long curPage) {

		this.curPage = curPage;
	}

	public long getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(long totalPage) {

		this.totalPage = totalPage;
	}

	public long getTotalRows() {
		return totalRows;
	}

	public void setTotalRows(long totalRows) {

		this.totalRows = totalRows;
	}

	public long getPageSize() {
		return pageSize;
	}

	public void setPageSize(long pageSize) {

		this.pageSize = pageSize;
	}

	public long getNextPage() {
		return this.curPage + 1 <= this.totalPage ? (this.curPage + 1)
				: this.totalPage;
	}

	public long getUpPage() {
		return this.curPage - 1 <= 0 ? 1 : this.curPage - 1;
	}
	public String toString(){
		return "totalPage:"+this.totalPage +" totalRows:"+ this.totalRows+" curPage:"+this.curPage;
	}
}
